let proto = module.exports;

proto.userStatus = { /* 玩家状态 */
	NONE: 0,
	ABANDON: 1,  /* 放弃 */
	TIMEOUTABANDON: 2,  /* 超时放弃 */
	LOOK: 4,  /* 看牌 */
	LOSE: 8,  /* 比牌失败 */
	WIN: 16, /* 胜利 */
	HE: 32, /* 和 */
};

proto.gameStatus = {
	NONE: 0, //等待操作
	ROB_BANK: 1, //玩家抢庄
	POUR_SCORE: 2, //闲家倍数
	SEND_CARDS: 3, //发牌
	SHOW_CARD: 4, //用户亮牌操作
	RESULT: 5, /* 显示结果 */
	START_GAME: 6, //游戏开始
	WASH_CARD: 7, //玩家切牌

};


proto.gameStatusTm = {
	NONE: 0, /* 等待操作 */
	ROB_BANK: 10, /* 抢庄 */
	SEND_CARDS: 2, /* 发牌中 */
	POUR_SCORE: 10, /* 下分中 */
	SHOW_CARD: 2, /* 用户亮牌操作 */
	QIE_GUO: 10, //切锅
	RESULT: 5, /* 显示结果 */
	START_GAME: 2, //游戏开始
	WASH_CARD: 3, //洗牌
};

proto.cardType = {
	ERROR: -1,               // 错误
	BISI: 0,                  //必10
	DIAN: 1,              	// 点
	ER_BA_GANG: 2,			//二八杠
	DUI_ZI: 3,				//对子
	SHUANG_TIAN_ZHI_ZUN: 4,	//双天至尊
};

//庄家规则
proto.gameType = {
	TONGBI: 2, /* 通比 */
	QIANGZHUANG: 1, /* 抢庄 */
	KANPAI: 3, //看牌下注
};

//庄家推送
proto.GAME_BANKER_PUSH = 601;
proto.gameBankerPush = function (uid, userList) {
	return {
		type: this.GAME_BANKER_PUSH,
		data: { uid, userList },
	};
};

proto.GAME_ROB_BANK_NOTIFY = 502; /* 抢庄通知 */
proto.GAME_ROB_BANK_PUSH = 602; /* 抢庄结果 */
proto.gameRobBankPush = function (uid, chairID, robScale) {
	return {
		type: this.GAME_ROB_BANK_PUSH,
		data: { uid, chairID, robScale },
	};
};


//发玩家手牌
proto.GAME_SEND_CARDS_PUSH = 603;
proto.gameSendCardPush = function (handCards, mapai, teShuType = 0, userList, baoCards) {

	return {
		type: this.GAME_SEND_CARDS_PUSH,
		data: {
			handCards, mapai, teShuType, userList, baoCards
		},
	};
};



//玩家下分操作推送
proto.GAME_USER_POUR_SCORE_PUSH = 605;
proto.gameUserPourScorePush = function (bankerUid, tick, scoreList) {
	return {
		type: this.GAME_USER_POUR_SCORE_PUSH,
		data: { bankerUid, tick, scoreList },
	};
};


//游戏结果推送
proto.GAME_RESULT_PUSH = 606;
proto.gameResultPush = function (result, bankerUid) {
	return {
		type: this.GAME_RESULT_PUSH,
		data: {
			result, bankerUid
		},
	};
};


//牌面回房
proto.GAME_REVIEW_NOTIFY = 507;
proto.GAME_REVIEW_PUSH = 607;
proto.gameReviewPush = function (list) {
	return {
		type: this.GAME_REVIEW_PUSH,
		data: {
			list: list,
		},
	};
};

//局数推送
proto.GAME_BUREAU_PUSH = 608;
proto.gameBureauPush = function (curBureau) {
	return {
		type: this.GAME_BUREAU_PUSH,
		data: {
			curBureau: curBureau,
		},
	};
};


proto.GAME_END_PUSH = 609;
proto.gameEndPush = function (result, winMost, loseMost, creater, plusInfo, reason) {

	let curResult = {
		type: this.GAME_END_PUSH,
		data: {
			result: result,
			winMost: winMost,
			loseMost: loseMost,
			creater: creater,
			plusInfo: plusInfo,
			reason: reason,
		},
	};
	return curResult;
};



//亮牌推送
proto.SHOW_CARDS_NOTIFY = 512;
proto.SHOW_CARDS_PUSH = 612;
proto.showCardsPush = function (cardsList, uid, chairID = null) {
	return {
		type: this.SHOW_CARDS_PUSH,
		data: { chairID, uid, cardsList }
	};
};

proto.GAME_USER_SCORE_NOTIFY = 513; /* 下分通知 */
proto.GAME_USER_SCORE_PUSH = 613; /* 下分结果 */
proto.gameUserPourScore = function (uid, score) {
	return {
		type: this.GAME_USER_SCORE_PUSH,
		data: { uid, score },
	};
};


proto.GAME_MA_PAI_PUSH = 614; /* 马牌通知 */
proto.gameMaPaiPush = function (mapai) {
	return {
		type: this.GAME_MA_PAI_PUSH,
		data: { mapai },
	};
};

//用户切牌结果
proto.GAME_USER_WASH_CARD_NOTIFY = 515;
proto.GAME_USER_WASH_CARD_PUSH = 615;
proto.gameUserWashCardPush = function (userWashList, time) {
	return {
		type: this.GAME_USER_WASH_CARD_PUSH,
		data: { userWashList, time },
	};
};

//玩家选择切牌
proto.GAME_USER_CHOOSE_WASH_NOTIFY = 516;
proto.GAME_USER_CHOOSE_WASH_PUSH = 616;
proto.userChooseWashResult = function (uid, userWashList, success, message) {
	return {
		type: this.GAME_USER_CHOOSE_WASH_PUSH,
		data: { uid, userWashList, success, message },
	};
};

//计算时间
proto.GAME_START_TIME_DELAY_NOTIFY = 517;

//重新摆牌砖石不足
proto.RE_SHOW_CARDS_ERROR = 618;
proto.reShowCardsError = function (message) {
	return {
		type: this.RE_SHOW_CARDS_ERROR,
		data: { message },
	};
};


//用户换宝牌
proto.GAME_CHANGE_BAO_CARD_NOTIFY = 519;
proto.GAME_CHANGE_BAO_CARD_PUSH = 619;
proto.gameChangeBaoCardPush = function (uid, handCards, baoCards, baoCard) {
	return {
		type: this.GAME_CHANGE_BAO_CARD_PUSH,
		data: { uid, handCards, baoCards, baoCard },
	};
};

//用户换宝牌-备用
proto.GAME_CHANGE_BAO_CARD2_NOTIFY = 529;
proto.GAME_CHANGE_BAO_CARD2_PUSH = 620;
proto.gameChangeBaoCard2Push = function (uid, baoCard, count) {
	return {
		type: this.GAME_CHANGE_BAO_CARD2_PUSH,
		data: { uid, baoCard, count },
	};
};




//----------------------------调试功能------------------------------------


//换牌
proto.GAME_SET_TEST_CARDS_NOTIFY = 551;
proto.GAME_SET_TEST_CARDS_PUSH = 651;
proto.gameSetTestCardsPush = function (isSuccess) {
	return {
		type: this.GAME_SET_TEST_CARDS_PUSH,
		data: { isSuccess },
	};
};


//查询牌库
proto.GAME_GET_TEST_CARDS_NOTIFY = 552;
proto.GAME_GET_TEST_CARDS_PUSH = 652;
proto.gameGetTestCardsPush = function (uid, allCardsData, testCards = []) {
	return {
		type: this.GAME_GET_TEST_CARDS_PUSH,
		data: { uid, allCardsData, testCards },
	};
};





